package com.controller.ssjf;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.controller.base.BaseController;
import com.entity.FileRel;
import com.entity.News;
import com.entity.Statistics;
import com.service.FileRelService;
import com.service.NewsService;
import com.service.StatisticsService;

@Controller
@RequestMapping("/ssjf")
public class PageController extends BaseController<Object>{
	
	@Autowired
	private StatisticsService statisticsService;
	@Autowired 
	private NewsService newsService;
	@Autowired
	private FileRelService fileRelService;
	
	@RequestMapping("/index.html")
	public String index(Model model)throws Exception{
		//首页轮播图片
		FileRel rel = new FileRel();
		rel.setRemark("index-slider");
		List<FileRel> rels = fileRelService.find(rel);
		model.addAttribute("slider", rels);
		//数据统计
		Statistics Stats = statisticsService.statistics();
		model.addAttribute("Stats", Stats);
		//最新新闻公告
		List<News> newNewses = newsService.findNews(4);
		model.addAttribute("newNewses", newNewses);
		return "ssjf/index";
	}
	
	@RequestMapping("page/commentlist.html")
	public String commentlist()throws Exception{
		return "ssjf/pages/commentlist";
	}
	
	@RequestMapping("page/credit.html")
	public String credit()throws Exception{
		return "ssjf/pages/credit";
	}
	
	@RequestMapping("page/detail.html")
	public String detail()throws Exception{
		return "ssjf/pages/detail";
	}
	
	@RequestMapping("page/help.html")
	public String help()throws Exception{
		return "ssjf/pages/help";
	}
	
	@RequestMapping("page/login.html")
	public String login()throws Exception{
		return "ssjf/pages/login";
	}

	@RequestMapping("page/select.html")
	public String select()throws Exception{
		return "ssjf/pages/select";
	}
	
	@RequestMapping("page/state2.html")
	public String state2(Model model)throws Exception{
		model.addAttribute("isRecommend", false);
		return "ssjf/pages/state2";
	}
	
	@RequestMapping("page/upload.html")
	public String upload()throws Exception{
		return "ssjf/pages/upload";
	}
}
